//package com.jt.controller;//package com.jt.controller;
//
//import com.jt.config.RabbitmqConfig;
//import com.jt.config.RabbitmqConfig_RouterKey;
//import com.jt.config.RabbitmqConfig_fanout;
//import com.rabbitmq.client.Channel;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//@RestController
//@RequestMapping("/test")
//public class RabbitmqController {
//    @Autowired
//    private RabbitTemplate rabbitTemplate;
//
//    /*简单模式发送消息*/
//    @PostMapping("/message/{message}")
//    public String rabbitmqMessage(@PathVariable String message) throws Exception {
//        rabbitTemplate.convertAndSend("",RabbitmqConfig.name,"我是消息刘淑红，，哈哈");
//        System.out.println("消息发送了" + message);
//        return message;
//    }
//
//    /*广播模式发送消息*/
//    @PostMapping("/fanout/{fanout}")
//    public String rabbitmqMessage_fanout(@PathVariable String fanout) throws Exception {
//        rabbitTemplate.convertAndSend(RabbitmqConfig_fanout.FANOUT_EXCHANGE,"",fanout);
//        System.out.println("消息发送了" + fanout);
//        return fanout;
//    }
//
//
//    /*路由模式发送消息*/
//    @PostMapping("/direct/{direct}")
//    public String rabbitmqMessage_direct(@PathVariable String direct) throws Exception {
//        rabbitTemplate.convertAndSend(RabbitmqConfig_RouterKey.DIRECT_EXCHANGE,"two",direct);
//        System.out.println("消息发送了"+"路由key===" +"two"+ direct);
//        return direct;
//    }
//}
